/*
 *   Copyright (C) 2008 - 2009  FireBalls
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * @file Log.h This file contains a very simple Log class for simple text outputs.
 * @todo exchange the overloaded methods with a template
 */

// define
#ifndef __Log__
#define __Log__

// includes
#include <fstream>

/**
 * Simple Log class. For simple text outputs.
 */
class Log
{
    public:

        /**
         * Destructor. Makes sure the file stream is closed.
         */
        ~Log();

        /**
         * Opens file stream.
         * @param fileName Path to the file. File does not have to exist.
         * @return return true if file was opened.
         */
        bool OpenFile(const char* fileName);

        /**
         * Write method. Writes data to the file stream.
         */
        void Write(const char* var);
        void Write(const unsigned char* var);
        void Write(char var);
        void Write(unsigned char var);
        void Write(short var);
        void Write(unsigned short var);
        void Write(int var);
        void Write(unsigned int var);
        void Write(long var);
        void Write(unsigned long var);
        void Write(long long var);
        void Write(unsigned long long var);
        void Write(float var);
        void Write(double var);
        void Write(long double var);

        /**
         * End of line. Puts an \\n and flushes the buffer of the file stream.
         */
        void Endl();

    private:

        std::ofstream file;             ///< file stream

};

#endif
